<%--
 *  File:    ProductSelectPop.jsp
 *  @Author: Kevinfan
 *  Date:    4/11/2011
 *
 *  Copyright (C) 2000 - 2012 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only spc] skipping /oval/in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%
  //init param
  String privilegeCode = "ALL";
  String strTableName = "ovproductsummary";
  String strModuleName = "COM";
  String contextPath = request.getContextPath();
%>
<%@ include file="/inc/CommonHeader.inc"%>
<%@ include file="/inc/OvalLocationDefault.inc"%>

<html>
<head>
<title>Product Select</title>
<PageFlow:CheckPageFlow pageName="p_proudctsummary" />
<%@ include file="/inc/CatchError.inc"%>
<%@ include file="/inc/SumDiv.inc"%>

<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<link rel="stylesheet"
	href="<%=contextPath%>/css/<%= strLanguageCode %>/main.css"
	type="text/css">
<script language="JavaScript"
	src="<%=contextPath%>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/ScriptLib.js"></script>
<script language="JavaScript"
	src="<%=contextPath%>/js/SummaryDivision.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/PopWindow.js"></script>
<script language="JavaScript">

function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(cform,actionvalue,orderbyname);
  if(!editform) return;
  editform.action = "ProdSelectPop.jsp?maxitem=10&<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();
}

function clickRow(obj,idx)
{
  var cform = document.cform;
  cform.radiorow[idx].checked=true;
  cform.prodid.value = eval('obj.all.prodid'+idx).value;
  cform.prodcode.value = eval('obj.all.prodcode'+idx).value;
  cform.unitprice.value = eval('obj.all.unitprice'+idx).value;
  cform.prodname.value = eval('obj.all.prodname'+idx).value;
  cform.spec.value = eval('obj.all.spec'+idx).value;
  parent.page_setProduct(cform.prodid.value,cform.prodcode.value,cform.prodname.value,cform.unitprice.value,cform.spec.value);
  parent.hiddenFrm();
}

</script>
</head>
<body>
<%
HashMap OneHash = (HashMap)session.getAttribute("onehash");
if(OneHash == null) OneHash = new HashMap();
%>
<% //--------------------------------------  hidden form variant --%>
<form name="cform" method="post" action="../Dispatcher" target="_self">
<input type="hidden" name="pagename" value="p_proudctsummary"> <input
	type="hidden" name="actionname"> <input type="hidden"
	name="returnvalue" value="<%=request.getParameter("returnvalue") %>"> 
	<custom:hidden property="hospitaldeptid"></custom:hidden>
	<custom:hidden property="hospitalid"></custom:hidden>
	<custom:hidden property="orgid"></custom:hidden>
	<custom:hidden property="year"></custom:hidden>
	<custom:hidden property="month"></custom:hidden>
	<custom:hidden property="doctorid"></custom:hidden>
	<custom:hidden property="mflag"/>
<table width="100%" cellspacing="0" border="0" cellpadding="0">
	<tr>
		<%--  search criteria  --%>
	</tr>
	<tr>
		<td>
		<table width="100%" border="0" cellspacing="0">
			<%@ include file="/inc/SummarySearch.inc"%>
		</table>
		</td>
	</tr>
	<tr>
		<td>
		<table width="100%" border="1" cellpadding="0"
			bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0">
			<form><%
    ArrayList titleTdArray = new ArrayList();
    titleTdArray.add(new TD("1%","&nbsp;"));
    titleTdArray.add(new TitleTD("25%","L_Code","prodcode"));
    titleTdArray.add(new TitleTD("49%","L_Name","prodname"));
%> <custom:titletr styleClass="deepblue-left"
				tdArray="<%=titleTdArray%>" /> <%
		        Vector totalsummary = (Vector)pageContext.getAttribute("totalsummary");
		        if(totalsummary == null) totalsummary = new Vector();
		  %> <%
      ArrayList detailTdArray = new ArrayList();
     detailTdArray.add(new RadioTD());
     detailTdArray.add(new WriteTD("prodcode"));
     detailTdArray.add(new WriteTD("prodname"));


	 //form hidden elements
     ArrayList hiddenArray = new ArrayList();
     hiddenArray.add(new HiddenInput("prodid",true));
     hiddenArray.add(new HiddenInput("prodcode",true));
     hiddenArray.add(new HiddenInput("prodname",true));
     hiddenArray.add(new HiddenInput("unitprice",true));
     hiddenArray.add(new HiddenInput("spec",true));
      %> <custom:iteratetr tdArray="<%=detailTdArray%>"
				hiddenArray="<%=hiddenArray%>" dataSource="totalsummary" /> <%@include
				file="/inc/SummaryAction.inc"%></form>
		</table>
		</td>
	</tr>
</table>
</form>
<%
	if (totalsummary.size() == 1) {
%>
<script>parent.page_setProduct(cform.prodid.value,cform.prodcode.value,cform.prodname.value,cform.unitprice.value,cform.spec.value);</script>
<%}%>
</body>
</html>
